<?php

namespace App\model;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Http\Request;
use App\Http\Requests;

class Company extends Model
{
    
	public $timestamps = false;

    protected $table = 'company';

   	
	/**
	 *  单图片上传
	 *  *****
	 */
    public function img($file)
	{

         if(!$file->isValid())
		 {
            exit('文件上传出错！');
         }

         $destPath = realpath(public_path('images'));
			   
         if(!file_exists($destPath))
               mkdir($destPath,0755,true);

         $filename = $file->getClientOriginalName();
		 $arr=$file->move($destPath,$filename);
         if($arr)
		 {
             return '/images/'.$filename;

         }else{
		 
		     return '保存文件失败！';
		 }
		

	}
	
}
